import request from '@/utils/axios'

// 热搜
export function searchHot() {
  return request({
    url: '/search/hot',
    method: 'get'
  })
}

// 搜索
export function search(keyWords, page = 0, limit = 30) {
  return request({
    url: '/search',
    method: 'get',
    params: {
      offset: page * limit,
      limit: limit,
      keywords: keyWords,
    }
  })
}

// 获取音乐评论
export function getComment(id, page = 0, limit = 30) {
  return request({
    url: '/comment/music',
    method: 'get',
    params: {
      offset: page * limit,
      limit: limit,
      id,
    }
  })
}

// 推荐歌单
export function getPersonalized() {
  return request({
    url: '/personalized',
    method: 'get',
  })
}

// 排行榜列表
export function getToplistDetail() {
  return request({
    url: '/toplist/detail',
    method: 'get',
  })
}

export function getPlaylistDetail(id) {
  return request({
    url: '/playlist/detail',
    method: 'get',
    params: {
      id
    }
  })
}

// 获取歌词
export function getLyric(id) {
  return request({
    url: '/lyric?id=' + id,
    method: 'get',
  })
}

// 获取音乐地址
export function getMusicUrl(id) {
  return request({
    url: '/song/url?id=' + id,
    method: 'get',
  })
}
